from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

app_name = 'users'

# 创建路由器并注册视图集
router = DefaultRouter()
router.register('', views.UserViewSet, basename='user')

urlpatterns = [
    # Token资源相关路由
    path('tokens/', views.TokensView.as_view(), name='tokens'),  # POST: 创建token（登录）, DELETE: 删除token（登出）
    path('tokens/refresh/', views.TokensRefreshView.as_view(), name='token_refresh'),  # POST: 刷新token
    
    # 用户资源相关路由
    path('users/', include(router.urls)),  # 用户资源的CRUD操作
]
